From 503e2ed4819b8e7931efff7c6a87d35f0df71b35 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Tue, 10 Jul 2007 10:13:16 +0100 Subject: [PATCH] xend: Count CPUs rather than relying on a static nodes/sockets/cores/threads relationship. Signed-off-by: Alex Williamson --- tools/python/xen/xend/XendNode.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/python/xen/xend/XendNode.py b/tools/python/xen/xend/XendNode.py index 60189fbe7b..969c72dbc7 100644 --- a/tools/python/xen/xend/XendNode.py +++ b/tools/python/xen/xend/XendNode.py @@ -580,14 +580,17 @@ class XendNode: str='none\n' return str[:-1]; + def count_cpus(self, pinfo): + count=0 + node_to_cpu=pinfo['node_to_cpu'] + for i in range(0, pinfo['nr_nodes']): + count+=len(node_to_cpu[i]) + return count; def physinfo(self): info = self.xc.physinfo() - info['nr_cpus'] = (info['nr_nodes'] * - info['sockets_per_node'] * - info['cores_per_socket'] * - info['threads_per_core']) + info['nr_cpus'] = self.count_cpus(info) info['cpu_mhz'] = info['cpu_khz'] / 1000 # physinfo is in KiB, need it in MiB -- 2.30.2